package com.chentf.reggie.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * @author chentengfei
 * @desc ...
 * @date 2023-03-06 20:42:11
 */
public class MyBeanPostProcessor implements BeanPostProcessor {

    public MyBeanPostProcessor(){
        super();
        System.out.println("这是BeanPostProcessor实现类构造器！！");
    }

   /***
    *
    * @author chentengfei
    * @date 2023/3/6 20:45
    * @param arg0 第一个参数都是要处理的Bean对象
    * @param arg1 第二个参数都是Bean的name 返回值也都是要处理的Bean对象
    * @return java.lang.Object
    */
    @Override
    public Object postProcessBeforeInitialization(Object arg0, String arg1) throws BeansException {
        System.out.println("BeanPostProcessor接口方法postProcessAfterInitialization对属性进行更改！");
        return arg0;
    }

    @Override
    public Object postProcessAfterInitialization(Object arg0, String arg1) throws BeansException {
        System.out.println("BeanPostProcessor接口方法postProcessBeforeInitialization对属性进行更改！");
        return arg0;
    }
}
